package com.yanqu.road.server.channelserver.cmd.activity.washe.friend;

import com.yanqu.road.entity.activity.washe.data.WasheUserKey;
import com.yanqu.road.logic.pb.WashePb2;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.WasheProto;
import com.yanqu.road.server.channelserver.cmd.ChannelCommand;
import com.yanqu.road.server.channelserver.manager.activity.washe.ChannelWasheActivity;
import com.yanqu.road.server.channelserver.manager.activity.washe.ChannelWasheMgr;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.protocol.ChannelProtocol;

@Cmd(code = ChannelProtocol.N_WASHE_FRIEND_SEARCH_ROOM, desc = "")
public class ChannelWasheFriendSearchRoomCmd extends ChannelCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WasheProto.ChannelWasheFriendSearchRoomReqMsg reqMsg = WasheProto.ChannelWasheFriendSearchRoomReqMsg.parseFrom(packet.getBytes());
        WasheUserKey userKey = WashePb2.parseWasheUserKey(reqMsg.getUserKey());

        ChannelWasheActivity activity = ChannelWasheMgr.getActivity(userKey.getChannelId());
        if (activity == null) {
            log.error("can not find washe activity! channelId {}.", userKey.getChannelId());
            return true;
        }

        activity.friendSearchRoomByCmd(userKey, reqMsg.getRoomId());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
